package Top_Interview_Questions.Array;

/**
 * @Author: 吕庆龙
 * @Date: 2020/3/12 14:48
 * <p>
 * 功能描述:
 */
public class _0066 {

    public static void main(String[] args) {
        _0066 test = new _0066();
        int[] nums = {1,9,9};
        test.plusOne(nums);
    }

    public int[] plusOne(int[] digits) {
        int len = digits.length;
        for(int i = len - 1; i >= 0; i--) {
            digits[i]++;
            digits[i] %= 10;
            if(digits[i]!=0)
                return digits;
        }
        digits = new int[len + 1];
        digits[0] = 1;
        return digits;
    }

}
